/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package uns.fit.gis.ui;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import uns.fit.gis.MapDrawer;
import uns.fit.gis.i18n.LocaleManager;
import uns.fit.gis.serviceapp.ArrayOfDouble;
import uns.fit.gis.serviceapp.Connector;

/**
 *
 * @author Ninh
 */
public class InforCellService extends Form implements CommandListener{

    private MapDrawer midlet;
    private Command backCommand;

    public InforCellService(MapDrawer midlet) {
        super("");
        this.midlet = MapDrawer.getMidlet();
        setCommandListener(this);
        backCommand=new Command(LocaleManager.getMessage("back"),Command.SCREEN,3);
        addCommand(backCommand);

        this.deleteAll();
        
        this.append("CellID: "+Connector.t.getCellID()+'\n');
        this.append("IMEI: "+Connector.t.getImei()+'\n');
        this.append("Time: "+Connector.t.getTime()+'\n');

        try {
            ArrayOfDouble arr = Connector.service.tinhVT(Connector.t.getImei(), null);
            double[] result = arr.get_double();
            
            for(int i=0; i<result.length; i++){
                this.append(Double.toString(result[i]+'\n'));
            }

        } catch (Exception e) {
        }
    }
    
    public void commandAction(Command c, Displayable displayable) {
        if(c == backCommand)
        {
            midlet.showMapCanvas();
        }
    }
}
